
var DISAPPEAR_COUNT_TAG = "DISAPPEAR_COUNT_TAG";
var BAR_WIDTH_TAG = "BAR_WIDTH_TAG";
var COIN_INTERNAL_TAG = "COIN_INTERNAL_TAG";
var COIN_COUNT_TAG = "COIN_COUNT";
var AD_TAG = "AD_TAG";
var AD_NUMBER = "AD_NUMBER";

var MUSIC_STATE = "MUSIC";

var Storage = {

		getMusicState: function() {
			var coin = cc.sys.localStorage.getItem(MUSIC_STATE) || 1;
			if(coin == 0)
				return false;
			else
				return true;
		},

		setMusicState: function(on) {
			var number = on ? 1 : 0;
			cc.sys.localStorage.setItem(MUSIC_STATE, number) || 1;
			return true;
		},
		
		getCoin: function() {
			var number = cc.sys.localStorage.getItem(COIN_COUNT_TAG) || 0;
			return parseInt(number);
		},
		setCoin: function(coin) {
			cc.sys.localStorage.setItem(COIN_COUNT_TAG, coin);
			return true;
		},
		
		getAdNumber: function() {
			var number = cc.sys.localStorage.getItem(AD_NUMBER) || 0;
			return parseInt(number);
		},

		setAdNumber: function(number) {
			cc.sys.localStorage.setItem(AD_NUMBER, number) || 0;
			return true;
		}
}
var EnhenceSys = {
		disappearCountEnhence: {
			set: function() {
				var level = cc.sys.localStorage.getItem(DISAPPEAR_COUNT_TAG) || 0;
				level = parseInt(level) + 1;
				cc.sys.localStorage.setItem(DISAPPEAR_COUNT_TAG, level) || 0;
				return true;
			},
			get: function() {
				var level = cc.sys.localStorage.getItem(DISAPPEAR_COUNT_TAG) || 0;
				return parseInt(level);
			}
		},

		barWidthEnhence: {
			set: function() {
				var level = cc.sys.localStorage.getItem(BAR_WIDTH_TAG) || 0;
				level = parseInt(level) + 1;
				cc.sys.localStorage.setItem(BAR_WIDTH_TAG, level) || 0;
				return true;
			},
			get: function() {
				var level = cc.sys.localStorage.getItem(BAR_WIDTH_TAG) || 0;
				return parseInt(level);
			}
		},

		coinInternalEnhence: {
			set: function() {
				var level = cc.sys.localStorage.getItem(COIN_INTERNAL_TAG) || 0;
				level = parseInt(level) + 1;
				cc.sys.localStorage.setItem(COIN_INTERNAL_TAG, level) || 0;
				return true;
			},
			get: function() {
				var level = cc.sys.localStorage.getItem(COIN_INTERNAL_TAG) || 0;
				return parseInt(level);
			}
		},

		adEnhence: {
			set: function() {
				var level = cc.sys.localStorage.getItem(AD_TAG) || 0;
				level = parseInt(level) + 1;
				cc.sys.localStorage.setItem(AD_TAG, level) || 0;

				Storage.setAdNumber(3);

				return true;
			},
			get: function() {
				var level = cc.sys.localStorage.getItem(AD_TAG) || 0;
				return parseInt(level);
			}
		}
}
